$(function () {
    var page= $(".numhhh").val();
    
    $.ajax({
        type:"POST",
        url:"/Store/exchangelogList2",
        data:{"page":page},
        dataType:"json",
        success:function (data) {
            var cgstr2 = "";
            $(".exchange_record_table").html("");
            cgstr2 += "<tr>"
            cgstr2 += "<td class=\"left\">商品名称</td>"
            cgstr2 += "<td>消耗钱帮币</td>"
            cgstr2 += "<td>数量</td>"
            cgstr2 += "<td>用户名</td>"
            cgstr2 += "<td>物流情况</td>"
            cgstr2 += "<td>发货</td>"
            cgstr2 += "<td style=\"text-align:right;\">订单号</td>"
            cgstr2 += "</tr>"
            $(".exchange_record_table").append(cgstr2);
            var flag = data.flag;
            var cgstr = "";
            if(flag == "F"){
               cgstr += " <tr><td colspan=\"6\">没有数据</td></tr> ";
                $(".exchange_record_table").append(cgstr);
                alert("抱歉，您的用户没有订单信息！");
            }else {
                var Count =data.Count;
                $(".none").val(Count);
                var LdList = $(data.LdList);
                LdList.each(function () {
                    cgstr +=  "<tr>"
                    cgstr += "<td style=\"display: none\">"+this.orderNum+"</td>"
                    cgstr += "<td class=\"left\">"+this.commodityName+"</td>"
                    cgstr +=  "<td>"+this.price+"</td>"
                    cgstr +=  "<td>"+this.number+"</td>"
                    cgstr += "<td>"+this.userName+"</td>"
                    cgstr += "<td>"+this.flow+"</td>"
                     if(this.delivery == 0){
                         cgstr += "<td><button  class=\"fahuo\">发货</button></td>"
                     }else if(this.delivery == 1){
                         cgstr +="<td>已发货</td>"
                     }
                    cgstr +=  "<td style=\"text-align:right;\">"+this.orderNum+"</td> </tr>"
                })

                $(".exchange_record_table").append(cgstr);

            }

            $(".fahuo").click(function () {
              var orderNum =$(this).parent().parent().children().eq(0).html();
                window.location.href="/Store/fahuo?id="+parseInt(orderNum);
            })
            
        },error:function(e){
            alert("cuowu!!!");
            console.log(e);

        }

    });





})

